package com.z.utils;

import java.util.Arrays;
import java.util.Map;
import java.util.Set;

/**
 * @author 张福兴
 * date 2021/9/4
 */
public class TermUtil {
    public static String getTerm(Map<String, String[]> map) {
        String term = "";
        Set<Map.Entry<String, String[]>> entries = map.entrySet();
        for (Map.Entry<String, String[]> entry : entries) {
            for (String s : entry.getValue()) {
                if("gname".equals(entry.getKey())){
                    term +=" and "+ entry.getKey() +" like '%"+s +"%'";

                }else {
                    term +=" and "+ entry.getKey() +" = '"+s +"'";

                }
            }
        }
        term=   term.substring(term.indexOf("and")+3);
        return  term;
    }
}
